package com.graduation.mybatis.mapper;

import com.graduation.mybatis.bean.DietRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.graduation.mybatis.bean.DietRecordVO;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;

/**
* @author 23726
* @description 针对表【diet_record】的数据库操作Mapper
* @createDate 2025-04-07 18:59:01
* @Entity com.graduation.mybatis.bean.DietRecord
*/
public interface DietRecordMapper extends BaseMapper<DietRecord> {
    // 根据用户ID和餐次类型查询饮食记录
    List<DietRecordVO> selectDailyRecords(@Param("userId") Long userId, @Param("mealType") Integer mealType, @Param("date")
            LocalDate date);

    // 根据用户ID查询所有饮食记录
    List<DietRecordVO> selectDailyRecordsByUserId(@Param("userId") Long userId, @Param("date") LocalDate date);

    // 根据用户ID和日期查询所有饮食记录
    List<DietRecordVO> selectAllDailyRecords(@Param("userId") Long userId, @Param("date") LocalDate date);

    List<DietRecordVO> selectPeriodyMealSummaries(@Param("userId") Long userId,
                                                  @Param("period") Integer period,
                                                  @Param("date") String date);
    void deleteFoodEntryById(@Param("foodEntryId") Long foodEntryId);

    void deleteDietRecordByFoodEntryId(@Param("foodEntryId") Long foodEntryId);

}




